home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / include / windowstr.h < prev   
Encoding:
C/C++ Source or Header  |  1990-02-15  |  6.2 KB  |  175 lines

  1. /* $XConsortium: windowstr.h,v 5.13 89/10/04 10:27:15 rws Exp $ */
  2. /***********************************************************
  3. Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
  4. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  5.  
  6.                         All Rights Reserved
  7.  
  8. Permission to use, copy, modify, and distribute this software and its 
  9. documentation for any purpose and without fee is hereby granted, 
  10. provided that the above copyright notice appear in all copies and that
  11. both that copyright notice and this permission notice appear in 
  12. supporting documentation, and that the names of Digital or MIT not be
  13. used in advertising or publicity pertaining to distribution of the
  14. software without specific, written prior permission.  
  15.  
  16. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  17. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  18. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  19. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  20. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  21. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  22. SOFTWARE.
  23.  
  24. ******************************************************************/
  25.  
  26. #ifndef WINDOWSTRUCT_H
  27. #define WINDOWSTRUCT_H
  28.  
  29. #include "window.h"
  30. #include "pixmapstr.h"
  31. #include "regionstr.h"
  32. #include "cursor.h"
  33. #include "property.h"
  34. #include "resource.h"    /* for ROOT_WINDOW_ID_BASE */
  35. #include "dix.h"
  36. #include "miscstruct.h"
  37. #include "Xprotostr.h"
  38.  
  39. #define GuaranteeNothing    0
  40. #define GuaranteeVisBack    1
  41.  
  42. #define SameBackground(as, a, bs, b)                \
  43.     ((as) == (bs) && ((as) == None ||                \
  44.               (as) == ParentRelative ||            \
  45.                SamePixUnion(a,b,as == BackgroundPixel)))
  46.  
  47. #define SameBorder(as, a, bs, b)                \
  48.     EqualPixUnion(as, a, bs, b)
  49.  
  50. typedef struct _WindowOpt {
  51.     VisualID        visual;           /* default: same as parent */
  52.     CursorPtr        cursor;           /* default: window.cursorNone */
  53.     Colormap        colormap;       /* default: same as parent */
  54.     Mask        dontPropagateMask; /* default: window.dontPropagate */
  55.     Mask        otherEventMasks;   /* default: 0 */
  56.     struct _OtherClients *otherClients;       /* default: NULL */
  57.     struct _GrabRec    *passiveGrabs;       /* default: NULL */
  58.     PropertyPtr        userProps;       /* default: NULL */
  59.     unsigned long    backingBitPlanes;  /* default: ~0L */
  60.     unsigned long    backingPixel;       /* default: 0 */
  61. #ifdef SHAPE
  62.     RegionPtr        boundingShape;       /* default: NULL */
  63.     RegionPtr        clipShape;       /* default: NULL */
  64. #endif
  65. #ifdef XINPUT
  66.     struct _OtherInputMasks *inputMasks;   /* default: NULL */
  67. #endif
  68. } WindowOptRec, *WindowOptPtr;
  69.  
  70. #define BackgroundPixel        2L
  71. #define BackgroundPixmap    3L
  72.  
  73. typedef struct _Window {
  74.     DrawableRec        drawable;
  75.     WindowPtr        parent;        /* ancestor chain */
  76.     WindowPtr        nextSib;    /* next lower sibling */
  77.     WindowPtr        prevSib;    /* next higher sibling */
  78.     WindowPtr        firstChild;    /* top-most child */
  79.     WindowPtr        lastChild;    /* bottom-most child */
  80.     RegionRec        clipList;    /* clipping rectangle for output */
  81.     RegionRec        borderClip;    /* NotClippedByChildren + border */
  82.     union _Validate    *valdata;
  83.     RegionRec        winSize;
  84.     RegionRec        borderSize;
  85.     DDXPointRec        origin;        /* position relative to parent */
  86.     unsigned short    borderWidth;
  87.     unsigned short    deliverableEvents;
  88.     Mask        eventMask;
  89.     PixUnion        background;
  90.     PixUnion        border;
  91.     pointer        backStorage;    /* null when BS disabled */
  92.     WindowOptPtr    optional;
  93.     unsigned        backgroundState:2; /* None, Relative, Pixel, Pixmap */
  94.     unsigned        borderIsPixel:1;
  95.     unsigned        cursorIsNone:1;    /* else same as parent */
  96.     unsigned        backingStore:2;
  97.     unsigned        saveUnder:1;
  98.     unsigned        DIXsaveUnder:1;
  99.     unsigned        bitGravity:4;
  100.     unsigned        winGravity:4;
  101.     unsigned        overrideRedirect:1;
  102.     unsigned        visibility:2;
  103.     unsigned        mapped:1;
  104.     unsigned        realized:1;    /* ancestors are all mapped */
  105.     unsigned        viewable:1;    /* realized && InputOutput */
  106.     unsigned        dontPropagate:3;/* index into DontPropagateMasks */
  107.     DevUnion        *devPrivates;
  108. } WindowRec;
  109.  
  110. /*
  111.  * Ok, a bunch of macros for accessing the optional record
  112.  * fields (or filling the appropriate default value)
  113.  */
  114.  
  115. extern WindowPtr    FindWindowWithOptional();
  116. extern Mask        DontPropagateMasks[];
  117.  
  118. #define wTrackParent(w,field)    ((w)->optional ? \
  119.                     w->optional->field \
  120.                   : FindWindowWithOptional(w)->optional->field)
  121. #define wUseDefault(w,field,def)    ((w)->optional ? \
  122.                     w->optional->field \
  123.                  : def)
  124.  
  125. #define wVisual(w)        wTrackParent(w, visual)
  126. #define wCursor(w)        ((w)->cursorIsNone ? None : wTrackParent(w, cursor))
  127. #define wColormap(w)        ((w)->drawable.class == InputOnly ? None : wTrackParent(w, colormap))
  128. #define wDontPropagateMask(w)    wUseDefault(w, dontPropagateMask, DontPropagateMasks[(w)->dontPropagate])
  129. #define wOtherEventMasks(w)    wUseDefault(w, otherEventMasks, 0)
  130. #define wOtherClients(w)    wUseDefault(w, otherClients, NULL)
  131. #ifdef XINPUT
  132. #define wOtherInputMasks(w)    wUseDefault(w, inputMasks, NULL)
  133. #else
  134. #define wOtherInputMasks(w)    NULL
  135. #endif
  136. #define wPassiveGrabs(w)    wUseDefault(w, passiveGrabs, NULL)
  137. #define wUserProps(w)        wUseDefault(w, userProps, NULL)
  138. #define wBackingBitPlanes(w)    wUseDefault(w, backingBitPlanes, ~0L)
  139. #define wBackingPixel(w)    wUseDefault(w, backingPixel, 0)
  140. #ifdef SHAPE
  141. #define wBoundingShape(w)    wUseDefault(w, boundingShape, NULL)
  142. #define wClipShape(w)        wUseDefault(w, clipShape, NULL)
  143. #endif
  144. #define wClient(w)        (clients[CLIENT_ID((w)->drawable.id)])
  145. #define wBorderWidth(w)        ((int) (w)->borderWidth)
  146.  
  147. /* true when w needs a border drawn. */
  148.  
  149. #ifdef SHAPE
  150. #define HasBorder(w)    ((w)->borderWidth || wClipShape(w))
  151. #else
  152. #define HasBorder(w)    ((w)->borderWidth)
  153. #endif
  154.  
  155. extern int DeleteWindow();
  156. extern int ChangeWindowAttributes();
  157. extern int WalkTree();
  158. extern Bool CreateRootWindow();
  159. extern WindowPtr CreateWindow();
  160. extern int DeleteWindow();
  161. extern int DestroySubwindows();
  162. extern int ChangeWindowAttributes();
  163. extern int GetWindowAttributes();
  164. extern int ConfigureWindow();
  165. extern int ReparentWindow();
  166. extern int MapWindow();
  167. extern int MapSubwindow();
  168. extern int UnmapWindow();
  169. extern int UnmapSubwindow();
  170. extern RegionPtr NotClippedByChildren();
  171. extern void SendVisibilityNotify();
  172.  
  173. #endif /* WINDOWSTRUCT_H */
  174.  
  175.